package winter_vacation_homework.day_05;

/**
 * 一对相亲数是指：甲的约数之和等于乙，乙的约数之和等于甲。求1000以内的相亲数。
 */
public class Question1 {
    public static void main(String[] args) {
        for (int i = 1; i < 1000; i++) {
            int num1 = sumDivisor(i);
            int num2 = sumDivisor(num1);
            if(num2 == i){
                if(num1 != i){
                    System.out.println(i + " " + num1);
                    break;
                }
            }
        }
    }
    public static int sumDivisor(int num){
        int sum = 0;
        for (int i = 1; i < num; i++) {
            if(num % i == 0){
                sum += i;
            }
        }
        return sum;
    }
}
